package com.fulu.game.bi.controller.channel;

import com.fulu.game.bi.common.controller.BaseController;
import com.fulu.game.bi.entity.po.channel.Label;
import com.fulu.game.bi.entity.po.channel.RegistSource;
import com.fulu.game.bi.entity.vo.Result;
import com.fulu.game.bi.entity.vo.channel.label.LabelDisplayVO;
import com.fulu.game.bi.entity.vo.channel.label.LabelQueryVO;
import com.fulu.game.bi.entity.vo.channel.label.LabelSaveVO;
import com.fulu.game.bi.entity.vo.channel.source.RegisterSourceQueryVO;
import com.fulu.game.bi.entity.vo.channel.source.RegisterSourceSaveVO;
import com.fulu.game.bi.redis.service.channel.LabelService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 标签管理
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/label")
public class LabelController extends BaseController {

    @Autowired
    private LabelService labelService;

    /**
     * 保存标签
     */
    @PostMapping("/save")
    public Result<Label> save(LabelSaveVO vo) {
        Label label = labelService.save(vo);

        return Result.success().data(label).msg("保存成功");
    }

    /**
     * 查询标签列表
     */
    @PostMapping("/list")
    public Result<PageInfo<LabelDisplayVO>> list(LabelQueryVO vo) {
        PageInfo<LabelDisplayVO> page = labelService.list(vo);

        return Result.success().data(page).msg("查询成功");
    }

}
